﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web;

namespace TaoPortal.Skin.Models
{
    public class ModelMappings
    {
        private Dictionary<string, Type> modelsDic = new Dictionary<string, Type>();

        public ModelMappings()
        {
            modelsDic.Add("home/index", typeof(HomeModel));
        }

        public dynamic GetModel(string controller, string action, HttpApplication Application)
        {
            string key = controller + "/" + action;
            if (modelsDic.Keys.Contains(key))
            {
                Type modeType = modelsDic[controller + "/" + action];
                dynamic model = Activator.CreateInstance(modeType) as dynamic;
                return model.Init(Application);
            }
            else
            {
                return new System.Dynamic.ExpandoObject();
            }
        }
    }
}
